package mr.zhang.service.impl;

import mr.zhang.dao.ButtonDao;
import mr.zhang.dao.SubButtonDao;
import mr.zhang.dao.domain.Button;
import mr.zhang.service.ButtonService;

import java.util.List;



public class ButtonServiceImpl implements ButtonService {
	
	private ButtonDao buttonDao;
	
	private SubButtonDao subButtonDao;

	public ButtonDao getButtonDao() {
		return buttonDao;
	}

	public void setButtonDao(ButtonDao buttonDao) {
		this.buttonDao = buttonDao;
	}

	public SubButtonDao getSubButtonDao() {
		return subButtonDao;
	}

	public void setSubButtonDao(SubButtonDao subButtonDao) {
		this.subButtonDao = subButtonDao;
	}

	@Override
	public void saveButton(Button button) {
		// TODO Auto-generated method stub
		
		this.buttonDao.saveButton(button);
		
	}

	@Override
	public void deleteButton(int id) {
		// TODO Auto-generated method stub
		this.subButtonDao.deleteAllSubButton(id);
		this.buttonDao.deleteButton(id);
		
	}

	@Override
	public void updateButton(Button button) {
		// TODO Auto-generated method stub
		
		this.buttonDao.updateButton(button);
		
	}

	@Override
	public Button queryButtonById(int id) {
		// TODO Auto-generated method stub
		
		return this.buttonDao.queryButtonById(id);
		
	}

	@Override
	public List<Button> queryButton() {
		// TODO Auto-generated method stub
		return this.buttonDao.queryButton();
	}

}
